package com.uniriho.lxr5002_service.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import com.uniriho.lxr5002_service.ServiceCrack;
import com.uniriho.lxr5002_service.utils.CrashExceptionHandler;
import com.uniriho.lxr5002_service.utils.LogUtils;

public class BootBroadcastReceiver extends BroadcastReceiver {
//    static final String ACTION = "android.intent.action.BOOT_COMPLETED";
    static final String ACTION = "intent.action.KINGBERRY_ACTION_BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent) {
        LogUtils.debug("onReceive", "intent.getAction() ===== " + intent.getAction());
        if (intent.getAction().equals(ACTION)) {
//            Toast.makeText(context, "服务启动成功", Toast.LENGTH_SHORT).show();
            Log.d("onReceive", "intent.getAction() ===== intent.action.KBY.ACTION_BOOT_COMPLETED");
            CrashExceptionHandler crashExceptionHandler = CrashExceptionHandler.newInstance();
            crashExceptionHandler.init(context);
            LogUtils.debug("onReceive","crashExceptionHandler");
            context.startService(new Intent(context, ServiceCrack.class));
            LogUtils.debug("onReceive","startService");
        }
    }
}